<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});


/*-----后台登陆-----*/
//后台登陆界面
Route::get('admin/login','Admin\LoginController@login');
//后台验证码路由
Route::get('admin/code/{id}','Admin\LoginController@code');
//后台登陆验证路由
Route::post('admin/islogin','Admin\LoginController@isLogin');


/**------后台路由组------**/
Route::group(['namespace' => 'Admin','prefix' => 'admin','middleware' => 'admin'],function(){

	/*-----后台主页面-----*/
	Route::resource('index','IndexController');
	//欢迎登陆界面
	Route::get('welcome','IndexController@welcome');
	//管理员退出
	Route::get('logout','IndexController@logout');

	/*----管理员管理路由-----*/
	//资源路由
	Route::resource('admin','AdminController');
	//管理员添加
	Route::post('add','AdminController@add');
	//管理员删除
	Route::post('del/{id}','AdminController@del');
	

	/*-----用户管理路由-----*/
	//用户资源路由
	Route::resource('user','UserController');
	//用户删除
	Route::post('deluser/{id}','UserController@del');
	//用户禁用
	Route::post('stopuser/{id}','UserController@stop');
	//用户启用
	Route::post('startuser/{id}','UserController@start');

	/*------产品栏目路由------*/
	//栏目列表
	Route::get('cat','CatController@index');
	//栏目增加页面
	Route::get('catcreate','CatController@create');
	//栏目添加操作
	Route::post('catadd','CatController@add');
	//栏目删除操作
	Route::post('catdel/{id}','CatController@del');
	//栏目编辑页面
	Route::get('catedit/{id}','CatController@edit');
	//栏目编辑操作
	Route::post('catupdate/{id}','CatController@update');

	/*-----产品路由-----*/
	Route::resource('goods','GoodsController');
	//产品下架
	Route::post('downgoods/{id}','GoodsController@down');
	//产品上架
	Route::post('upgoods/{id}','GoodsController@up');
	//产品删除
	Route::post('delgoods/{id}','GoodsController@del');
	//产品更新
	Route::post('updategoods/{id}','GoodsController@update1');

	/*-----订单路由-----*/
	Route::resource('orders','OrdersController');
	//订单删除
	Route::post('delorders/{id}','OrdersController@del');
	//订单发货
	Route::get('send/{id}','OrdersController@send');

	/*-----用户评论路由-----*/
	//评论列表页面
	Route::resource('comment', "CommentController");
	//删除评论
	Route::get('/comdel/{id}','CommentController@delete');
	//反馈列表页面
    Route::resource('req', "ReqController");
    //删除反馈
    Route::get('/reqdel/{id}',"ReqController@delete");

    /*----网站开关----*/
    //网站配置页面
    Route::get('config', "ConfigController@index");
    //改变网站模式
    Route::post('mode', "ConfigController@mode");
});

/*-----前台登陆-----*/
//前台登陆界面路面
Route::get('home/login','Home\LoginController@login');
//前台登陆验证路由
Route::post('home/islogin','Home\LoginController@isLogin');
//前台注册
Route::get('home/register','Home\LoginController@register');
Route::post('home/isreg','Home\LoginController@isreg');



/*-----前台路由组-----*/
Route::group(['namespace' => 'Home','prefix' => 'home','middleware' => 'home'],function(){
	/*-----后台主页面-----*/
	Route::resource('index','IndexController');
	//显示二级栏目的商品
	Route::get('subcat/{id}','IndexController@subcat');
	//显示所有商品
	Route::get('allcat/{id}','IndexController@allcat');
	//搜索商品
	Route::post('search','IndexController@search');

	//加入购物车
	Route::get('cart/{id}/{num}','IndexController@cart');
	Route::get('cart','IndexController@showcart');
	//购物车单个删除
	Route::get('delcart/{id}','IndexController@delcart');
	//清空购物车
	Route::get('delallcart','IndexController@delallcart');
	//产生订单
	Route::post('orders/{id}','IndexController@orders');
	//进行结算
	Route::get('pay/{id}','IndexController@pay');
	//结算成功
	Route::post('success/{id}','IndexController@success');

	//商品收藏
	Route::get('collect/{id}','CollectController@addcollect');
	Route::get('collect','CollectController@showcollect');
	//取消收藏
	Route::get('delcollect/{id}','CollectController@delcollect');

	/*-----用户中心-----*/
	//个人中心
	Route::resource('user','UserController');
	//用户订单
	Route::get('order/{id}','UserController@order');
	//用户删除订单
	Route::get('delorder/{id}','UserController@delorder');
	//用户添加评论页面
	Route::get('comment/{id}','UserController@comment');
	//添加评论操作
	Route::post('addcomment/{id}','UserController@addcomment');
	//用户所有评论页面
	Route::get('listcomment','UserController@listcomment');
	//用户意见反馈
	Route::get('req','UserController@req');
	Route::post('addreq','UserController@addreq');
	//查看用户回复
	Route::get('reply','UserController@reply');
	//用户退出
	Route::get('logout','UserController@logout');
});